<template>
  <div class="main">
    <div class="center">
      <div class="info">
        <div class="lf">
          <el-image lazy
            :src="varietyStepData.image"
            alt=""
            srcset=""
          />
        </div>
        <div class="rt">
          <div class="row">
            <div class="text">{{varietyStepData.parent_name}}</div>
          </div>
          <div class="row">
            <div class="text">{{varietyStepData.name}}</div>
          </div>
          <div class="row">
            <div class="text">{{varietyStepData.duration}}</div>
          </div>
        </div>
        <div class="play-btn">
          <a :href="varietyStepData.url_1" target="_blank" rel="noopener noreferrer">
            <el-image lazy :src="require('../assets/images/tx.png')" alt="" srcset="" />
          </a>
          <a :href="varietyStepData.url_2" target="_blank" rel="noopener noreferrer">
            <el-image lazy :src="require('../assets/images/iqiyi.png')" alt="" srcset="" />
          </a>
          <a :href="varietyStepData.url_3" target="_blank" rel="noopener noreferrer">
            <el-image lazy :src="require('../assets/images/youku.png')" alt="" srcset="" />
          </a>
        </div>
        <div class="qr-code">
          <el-image lazy :src="varietyStepData.code_url" alt="" srcset="" />
          <p>用手机观看</p>
        </div>
      </div>
      <div class="block-5">
        <div class="img" v-for="(item, index) in varietyStepData.images" :key="index">
          <el-image lazy
            src="http://placehold.it/300x200&text=300x200"
            alt=""
            srcset=""
          />
        </div>
      </div>
      <div class="cont" v-html="varietyStepData.detail"></div>
    </div>
    <!-- 广告 -->
    <div class="ad">
      <a
        target="_blank"
        class="item"
        :href="item.url"
        v-for="(item, index) in adData.slice(0, 5)"
        :key="index"
      >
        <el-image lazy :src="item.image_mini" alt="" />
      </a>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      varietyStepData: [],
      adData:[]
    };
  },
  created() {
    const id = this.$route.query.id;
    this.$http.getVarietyStep(id).then((res) => {
      if (res.data.code === 0) {
        this.varietyStepData = res.data.data;
        // console.log(res.data);
      } else {
        this.$message.error("获取失败，请重试！");
      }
    });
    // 广告
    this.$http.getAd().then((res) => {
      if (res.data.code === 0) {
        this.adData = res.data.data;
      } else {
        this.$message.error("获取失败，请重试！");
      }
    })
  },
};
</script>

<style lang="scss" scoped>
.center {
  width: 1600px;
  margin: 0 auto;
  .info {
    display: flex;
    justify-content: space-between;
    margin-top: 76px;
    position: relative;
    .lf {
      width: 460px;
      height: 330px;
      .el-image {
        width: 100%;
        height: 100%;
      }
    }
    .rt {
      width: 1110px;
      .row {
        display: flex;
        font-size: 20px;
        font-family: PingFang SC;
        font-weight: 400;
        line-height: 45px;
        .title {
          width: 130px;
          text-align-last: justify;
          text-align: justify;
          text-justify: distribute-all-lines;
          color: #999999;
        }
        .dian {
          color: #999999;
        }
        .text {
          width: 935px;
          margin-left: 10px;
          color: #333333;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 6;
          overflow: hidden;
        }
      }
      .row:first-child {
        .text {
          font-weight: bold;
        }
      }
      .row:not(:first-child) {
        margin-top: 6px;
      }
    }
    .play-btn {
      position: absolute;
      top: 0;
      right: 280px;
      .el-image {
        width: 48px;
        height: 48px;
        cursor: pointer;
      }
      a:not(:first-child) {
        margin-left: 55px;
      }
    }
    .qr-code {
      position: absolute;
      top: 0;
      right: 120px;
      width: 120px;
      text-align: center;
      .el-image {
        width: 92px;
        height: 92px;
      }
      p {
        width: 120px;
        height: 28px;
        font-size: 20px;
        font-family: PingFang SC;
        font-weight: bold;
        line-height: 28px;
        color: #333333;
        text-align: center;
        margin-top: 8px;
      }
    }
  }
  .block-5 {
    margin-top: 40px;
    .img:not(:nth-child(5n)) {
      margin-right: 21px;
    }
    .img {
      margin-bottom: 20px;
      width: 300px;
      height: 200px;
      display: inline-block;
      .el-image {
        width: 100%;
        height: 100%;
      }
    }
  }
  .cont {
    margin-top: 23px;
    margin-bottom: 80px;
    font-size: 16px;
    font-family: PingFang SC;
    font-weight: 400;
    color: #333333;
  }
}
.ad {
  position: fixed;
  top: 150px;
  right: 100px;
  z-index: 1000;
  .item {
    display: block;
    width: 150px;
    height: 150px;
    border-radius: 15px;
    overflow: hidden;
    .el-image {
      width: 100%;
      height: 100%;
    }
  }
  .item:not(:first-child) {
    margin-top: 30px;
  }
}
</style>